﻿<UserControl
    x:Class="WinRTXamlToolkit.Controls.AnimatingContainer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:WinRTXamlToolkit.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">
    
    <Grid
        x:Name="LayoutRoot">
        <ContentControl
            x:Name="ContentContainer"
            RenderTransformOrigin="0.1,0.1">
            <ContentControl.Resources>
                <Storyboard
                    x:Name="RotationStoryboard"
                    Storyboard.TargetName="RotatingTransform"
                    RepeatBehavior="Forever">
                    <DoubleAnimationUsingKeyFrames
                        Storyboard.TargetProperty="X">
                        <DiscreteDoubleKeyFrame
                            KeyTime="0:0:0"
                            Value="0" />
                        <EasingDoubleKeyFrame
                            x:Name="KeyRightX"
                            KeyTime="0:0:1"
                            Value="1">
                            <EasingDoubleKeyFrame.EasingFunction>
                                <SineEase
                                    EasingMode="EaseOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                        <EasingDoubleKeyFrame
                            x:Name="KeyBottomX"
                            KeyTime="0:0:2"
                            Value="0">
                            <EasingDoubleKeyFrame.EasingFunction>
                                <SineEase
                                    EasingMode="EaseIn" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                        <EasingDoubleKeyFrame
                            x:Name="KeyLeftX"
                            KeyTime="0:0:3"
                            Value="-1">
                            <EasingDoubleKeyFrame.EasingFunction>
                                <SineEase
                                    EasingMode="EaseOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                        <EasingDoubleKeyFrame
                            x:Name="KeyTopX"
                            KeyTime="0:0:4"
                            Value="0">
                            <EasingDoubleKeyFrame.EasingFunction>
                                <SineEase
                                    EasingMode="EaseIn" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames
                        Storyboard.TargetProperty="Y">
                        <DiscreteDoubleKeyFrame
                            KeyTime="0:0:0"
                            Value="0" />
                        <EasingDoubleKeyFrame
                            x:Name="KeyRightY"
                            KeyTime="0:0:1"
                            Value="1">
                            <EasingDoubleKeyFrame.EasingFunction>
                                <SineEase
                                    EasingMode="EaseIn" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                        <EasingDoubleKeyFrame
                            x:Name="KeyBottomY"
                            KeyTime="0:0:2"
                            Value="2">
                            <EasingDoubleKeyFrame.EasingFunction>
                                <SineEase
                                    EasingMode="EaseOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                        <EasingDoubleKeyFrame
                            x:Name="KeyLeftY"
                            KeyTime="0:0:3"
                            Value="1">
                            <EasingDoubleKeyFrame.EasingFunction>
                                <SineEase
                                    EasingMode="EaseIn" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                        <EasingDoubleKeyFrame
                            x:Name="KeyTopY"
                            KeyTime="0:0:4"
                            Value="0">
                            <EasingDoubleKeyFrame.EasingFunction>
                                <SineEase
                                    EasingMode="EaseOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
                <Storyboard
                    x:Name="PulsingStoryboard"
                    Storyboard.TargetName="PulseTransform"
                    RepeatBehavior="Forever"
                    AutoReverse="True"
                    SpeedRatio="0.4">
                    <DoubleAnimationUsingKeyFrames
                        Storyboard.TargetProperty="ScaleX">
                        <SplineDoubleKeyFrame
                            KeyTime="0"
                            Value="1.0" />
                        <EasingDoubleKeyFrame
                            x:Name="PulseKeyX"
                            KeyTime="0:0:3"
                            Value="1.05">
                            <EasingDoubleKeyFrame.EasingFunction>
                                <SineEase
                                    EasingMode="EaseInOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                    </DoubleAnimationUsingKeyFrames>
                    <DoubleAnimationUsingKeyFrames
                        Storyboard.TargetProperty="ScaleY">
                        <SplineDoubleKeyFrame
                            KeyTime="0"
                            Value="1.0" />
                        <EasingDoubleKeyFrame
                            x:Name="PulseKeyY"
                            KeyTime="0:0:3"
                            Value="1.05">
                            <EasingDoubleKeyFrame.EasingFunction>
                                <SineEase
                                    EasingMode="EaseInOut" />
                            </EasingDoubleKeyFrame.EasingFunction>
                        </EasingDoubleKeyFrame>
                    </DoubleAnimationUsingKeyFrames>
                </Storyboard>
            </ContentControl.Resources>
            <ContentControl.RenderTransform>
                <TransformGroup>
                    <TranslateTransform
                        x:Name="RotatingTransform" />
                    <ScaleTransform
                        x:Name="PulseTransform" />
                </TransformGroup>
            </ContentControl.RenderTransform>
        </ContentControl>
    </Grid>
</UserControl>
